home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 242 / Issue 242 - April 2008 - DPCS0408DVD.ISO / Software Money Savers / VirtualDub / Source / VirtualDub-1.7.7-src.7z / src / system / source / a_memory.asm next >
Encoding:
Assembly Source File  |  2006-03-14  |  3.1 KB  |  140 lines

  1. ;    VirtualDub - Video processing and capture application
  2. ;    System library component
  3. ;    Copyright (C) 1998-2004 Avery Lee, All Rights Reserved.
  4. ;
  5. ;    Beginning with 1.6.0, the VirtualDub system library is licensed
  6. ;    differently than the remainder of VirtualDub.  This particular file is
  7. ;    thus licensed as follows (the "zlib" license):
  8. ;
  9. ;    This software is provided 'as-is', without any express or implied
  10. ;    warranty.  In no event will the authors be held liable for any
  11. ;    damages arising from the use of this software.
  12. ;
  13. ;    Permission is granted to anyone to use this software for any purpose,
  14. ;    including commercial applications, and to alter it and redistribute it
  15. ;    freely, subject to the following restrictions:
  16. ;
  17. ;    1.    The origin of this software must not be misrepresented; you must
  18. ;        not claim that you wrote the original software. If you use this
  19. ;        software in a product, an acknowledgment in the product
  20. ;        documentation would be appreciated but is not required.
  21. ;    2.    Altered source versions must be plainly marked as such, and must
  22. ;        not be misrepresented as being the original software.
  23. ;    3.    This notice may not be removed or altered from any source
  24. ;        distribution.
  25.  
  26.         .686
  27.         .mmx
  28.         .xmm
  29.         .model        flat
  30.         .code
  31.  
  32. _VDFastMemcpyPartialScalarAligned8    proc    near public
  33.         mov        eax, [esp+12]
  34.         mov        edx, [esp+4]
  35.         mov        ecx, [esp+8]
  36.         add        ecx, eax
  37.         add        edx, eax
  38.         neg        eax
  39.         jz        @nobytes
  40.         add        eax, 8
  41.         jz        @doodd
  42.         jmp        short @xloop
  43.         align    16
  44. @xloop:
  45.         fild    qword ptr [ecx+eax-8]
  46.         fild    qword ptr [ecx+eax]
  47.         fxch
  48.         fistp    qword ptr [edx+eax-8]
  49.         fistp    qword ptr [edx+eax]
  50.         add        eax,16
  51.         jnc        @xloop
  52.         jnz        @nobytes
  53. @doodd:
  54.         fild    qword ptr [ecx-8]
  55.         fistp    qword ptr [edx-8]
  56. @nobytes:
  57.         ret
  58. _VDFastMemcpyPartialScalarAligned8    endp
  59.  
  60. _VDFastMemcpyPartialMMX        proc    near public
  61.         push    edi
  62.         push    esi
  63.  
  64.         mov        edi, [esp+4+8]
  65.         mov        esi, [esp+8+8]
  66.         mov        ecx, [esp+12+8]
  67.         mov        edx, ecx
  68.         shr        ecx, 2
  69.         and        edx, 3
  70.         rep        movsd
  71.         mov        ecx, edx
  72.         rep        movsb
  73.         pop        esi
  74.         pop        edi
  75.         ret
  76. _VDFastMemcpyPartialMMX        endp
  77.  
  78. _VDFastMemcpyPartialMMX2    proc    near public
  79.         push    ebp
  80.         push    edi
  81.         push    esi
  82.         push    ebx
  83.  
  84.         mov        ebx, [esp+4+16]
  85.         mov        edx, [esp+8+16]
  86.         mov        eax, [esp+12+16]
  87.         neg        eax
  88.         add        eax, 63
  89.         jbe        @skipblastloop
  90. @blastloop:
  91.         movq    mm0, [edx]
  92.         movq    mm1, [edx+8]
  93.         movq    mm2, [edx+16]
  94.         movq    mm3, [edx+24]
  95.         movq    mm4, [edx+32]
  96.         movq    mm5, [edx+40]
  97.         movq    mm6, [edx+48]
  98.         movq    mm7, [edx+56]
  99.         movntq    [ebx], mm0
  100.         movntq    [ebx+8], mm1
  101.         movntq    [ebx+16], mm2
  102.         movntq    [ebx+24], mm3
  103.         movntq    [ebx+32], mm4
  104.         movntq    [ebx+40], mm5
  105.         movntq    [ebx+48], mm6
  106.         movntq    [ebx+56], mm7
  107.         add        ebx, 64
  108.         add        edx, 64
  109.         add        eax, 64
  110.         jnc        @blastloop
  111. @skipblastloop:
  112.         sub        eax, 63-7
  113.         jns        @noextras
  114. @quadloop:
  115.         movq    mm0, [edx]
  116.         movntq    [ebx], mm0
  117.         add        edx, 8
  118.         add        ebx, 8
  119.         add        eax, 8
  120.         jnc        @quadloop
  121. @noextras:
  122.         sub        eax, 7
  123.         jz        @nooddballs
  124.         mov        ecx, eax
  125.         neg        ecx
  126.         mov        esi, edx
  127.         mov        edi, ebx
  128.         rep        movsb
  129. @nooddballs:
  130.         pop        ebx
  131.         pop        esi
  132.         pop        edi
  133.         pop        ebp
  134.         ret
  135. _VDFastMemcpyPartialMMX2    endp
  136.  
  137.  
  138.         end
  139.  
  140.